package com.wind.sqlite.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import com.wind.sqlite.common.base.BaseModelPageDTO;
import com.wind.sqlite.common.utils.PageUtils;
import com.wind.sqlite.common.utils.R;
import com.wind.sqlite.entity.WhiteListTEntity;
import com.wind.sqlite.common.base.BaseModelPageDTO;
import com.wind.sqlite.common.utils.PageUtils;
import com.wind.sqlite.common.utils.R;
import com.wind.sqlite.tools.WhilteTools;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.ResponseBody;
import com.wind.sqlite.entity.WhiteListTEntity;
import com.wind.sqlite.service.WhiteListTService;







/**
 * 白名单表
 *
 * @author bliang
 * @email 1270763655@qq.com
 * @date 2023-06-17 10:27:27
 */
@RestController
@RequestMapping("sys/whitelistt")
public class WhiteListTController {
    @Autowired
    private WhiteListTService whiteListTService;

    /**
     * 列表
     */
    @RequestMapping("/listByMap")
    //@RequiresPermissions("sqlite:whitelistt:list")
    public R listByMap(@RequestParam Map<String, Object> params){
        PageUtils page = whiteListTService.queryPage(params);

        return R.ok().put("page", page);
    }

  /**
* 列表
*/
  @RequestMapping("/listByDto")
  public R listByDto(@RequestBody BaseModelPageDTO<WhiteListTEntity> data){
    PageUtils page = whiteListTService.queryPage(data);
    return R.ok().put("page", page);
  }

    /**
     * 信息
     */
    @RequestMapping("/info/{processId}")
    //@RequiresPermissions("sqlite:whitelistt:info")
    public R info(@PathVariable("processId") Long processId){
		WhiteListTEntity whiteListT = whiteListTService.getById(processId);

        return R.ok().put("whiteListT", whiteListT);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("sqlite:whitelistt:save")
    public R save(@RequestBody BaseModelPageDTO<WhiteListTEntity> whiteListT){
		whiteListTService.save(whiteListT.getData());
        WhilteTools.setWhilteToCache();
        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("sqlite:whitelistt:update")
    public R update(@RequestBody BaseModelPageDTO<WhiteListTEntity> whiteListT){
		whiteListTService.updateById(whiteListT.getData());
        WhilteTools.setWhilteToCache();

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("sqlite:whitelistt:delete")
    public R delete(@RequestBody Long[] processIds){
		whiteListTService.removeByIds(Arrays.asList(processIds));
        WhilteTools.setWhilteToCache();

        return R.ok();
    }
}
